#include <linux/init.h> /* Needed for the macros */
#include <linux/kernel.h> /* Needed for pr_info() */
#include <linux/module.h> /* Needed by all modules */
#include <linux/timer.h>

static struct timer_list my_timer;

static void my_timer_func(unsigned long unused) {
	pr_info("timer expires , now  do sth 23333\n");
	if (!timer_pending(&my_timer)) {
		mod_timer(&my_timer, jiffies + 2 * HZ);
	}
}

static __init int my_init(void) {
		my_timer.function = my_timer_func;
		my_timer.expires= jiffies + msecs_to_jiffies(1000);
		my_timer.data=0;
		init_timer(&my_timer);
		mod_timer(&my_timer, jiffies + 2 * HZ);
//		add_timer(&my_timer);
		return 0;
}

static void __exit my_exit(void) {
		pr_info("a3 cleanup_module\n");
		del_timer(&my_timer);
}

module_init(my_init);
module_exit(my_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andy");
MODULE_DESCRIPTION("andy one-key driver");
MODULE_ALIAS("one-key");
